<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('盘点列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input name="companyId" type="text" id="companyId" style="display: none"/>
                    <div class="select-list">
                        <ul>
                            <li>
                                <input type="text" th:value="${assetNo}" name="searchParam" placeholder="序号/编号/资产编码/名称/型号"/>
                            </li>
                            <li>
                                <input type="text" th:value="${inventoryId}" name="inventoryId" placeholder="盘点编号"/>
                            </li>
                            <li>
                                <select name="status">
                                    <option value="">是否相符</option>
                                    <option value="1">是</option>
                                    <option value="0">否</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="inventory:inventory:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <!--<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="inventory:inventory:edit">-->
                    <!--<i class="fa fa-edit"></i> 修改-->
                <!--</a>-->
                <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="inventory:inventory:remove">-->
                    <!--<i class="fa fa-remove"></i> 删除-->
                <!--</a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="inventory:inventory:exportDetail">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var sUserAgent = navigator.userAgent.toLowerCase();
        var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
        var bIsIphone = sUserAgent.match(/iphone os/i) == 'iphone os';
        var bIsMidp = sUserAgent.match(/midp/i) == 'midp';
        var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
        var bIsUc = sUserAgent.match(/ucweb/i) == 'web';
        var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
        var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
        var bIsAndroid = sUserAgent.match(/android/i) == 'android';
        var isNotPc;
        if(bIsIpad || bIsIphone || bIsMidp || bIsUc7 || bIsUc || bIsCE || bIsWM || bIsAndroid ){
            isNotPc = true
            $("#toolbar").hide();
        }else{
            isNotPc = false
        }
        var editFlag = [[${@permission.hasPermi('inventory:inventory:edit')}]];
        var removeFlag = [[${@permission.hasPermi('inventory:inventory:remove')}]];
        var prefix = ctx + "inventory/inventory";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/exportDetail",
                modalName: "盘点",
                sortName:"updateTime",
                sortOrder:"desc",
                rowStyle:rowStyle,
                height:520,
                columns: [
                    {
                        field : 'inventoryId',
                        title : '盘点编号'
                    },
                    {
                        field : 'inventoryNo',
                        title : '资产序号'
                    },
                    {
                        field : 'assetNo',
                        title : '卡片编号'
                    },
                {
                    field : 'assetCode',
                    title : '资产编号',
                },
                {
                    field : 'assetName',
                    title : '资产名称'
                },
                {
                    field : 'specifications',
                    title : '规格'
                },
                {
                    field : 'assetModel',
                    title : '型号'
                },
                    {
                        field : 'manageDeptName',
                        title : '管理部门',
                    },
                    {
                        field : 'useDeptName',
                        title : '使用部门'
                    },
                    {
                        field : 'address',
                        title : '使用地点'
                    },
                 {
                    title : '是否相符',
                     formatter: function(value, row, index) {
                         var actions = [];
                         actions.push(row.status==1?"是":"否");
                         return actions.join('');
                     }
                 },
                    {
                        field : 'remark',
                        title : '备注',
                        width:200
                    },
                 {
                     field : 'createByName',
                     title : '盘点人'
                 },
                    {
                        field : 'updateTime',
                        title : '盘点时间'
                    }]
            };
            $.table.init(options);
        });
        //选择公司树
        function selectCompanyTree() {
            var deptId = $.common.isEmpty($("#companyId").val()) ? "100" : $("#companyId").val();
            var url = ctx + "system/dept/selectCompanyTree/" + deptId;
            var options = {
                title: '选择部门',
                width: "380",
                url: url,
                callBack: doSubmitCompany
            };
            $.modal.openOptions(options);
        }
        function doSubmitCompany(index, layero){
            var tree = layero.find("iframe")[0].contentWindow.$._tree;
            if ($.tree.notAllowParents(tree)) {
                var body = layer.getChildFrame('body', index);
                $("#companyId").val(body.find('#treeId').val());
                $("#companyName").val(body.find('#treeName').val());
                layer.close(index);
            }
        }
        function rowStyle(row, index) {
            if (row.status==0){
                return {classes:'danger'}
            }
            return {};
        }
    </script>
</body>
</html>